<%@page import="org.quickbundle.orgauth.cache.RmPartyTypeCache"%>
<%@page import="org.quickbundle.orgauth.IOrgauthConstants"%>
<%@page import="com.dfhc.rm.user.IUserConstants"%>
<%@page import="org.quickbundle.orgauth.rmuser.util.IRmUserConstants"%>
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@page import="org.quickbundle.orgauth.cache.RmPartyTypeCache"%>
<%@page import="org.quickbundle.orgauth.IOrgauthConstants"%>
<%@page import="com.dfhc.rm.user.IUserConstants"%>
<%@page import="org.quickbundle.orgauth.rmuser.util.IRmUserConstants"%>
<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />

<!-- 全局js 和css包 -->
<%@ include file="/jsp/include/web/new/global.jsp" %>
<title>用户管理</title>
<!--/meta 作为公共模版分离出去-->

<link rel="stylesheet" href="<%=request.getContextPath() %>/css/ztree/demo.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/ztree/zTreeStyle/zTreeStyle.css" type="text/css">
<%-- <script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery-1.4.4.min.js"></script> --%>
<%-- <script type="text/javascript" src="${pageContext.request.contextPath }/js/new/js/jquery.min.js"></script>   --%>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/ztree/jquery.ztree.excheck-3.5.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath }/js/h-ui.admin/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/js/h-ui.admin/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/js/h-ui.admin/jquery.validation/1.14.0/messages_zh.js"></script> 

<title>添加用户 </title>

<%@ taglib uri="/dfhc" prefix="dfhc" %>
</head>
<body>
<div style="z-index: 9999; display: none;" id="organizationContent">
		<div class="zTreeDemoBackground">
			<ul id="treeDemo" class="ztree"></ul>
		</div>
	</div>
<script type="text/javascript">
	var defaultSelectedNodes = parent.document.form1.old_code_id.value;
	var  nameArray=new Array(0);
	var codeArray=new Array(0);
	codeArray=defaultSelectedNodes.split(",");//初始化将系统之前选中的值赋给codeArray
	var setting = {
		   check: {
		    enable: true
	        },
	        data: {
				simpleData: {
					enable: true
				}
			}
	}
	var zNodes =[
     		<c:forEach var="bean" items="${lcvo}" varStatus="status">
     			<c:if test="${fn:length(bean.total_code) > 3}">
     			 
     		    	{id:${bean.total_code}, pId:${fn:substring(bean.total_code,0,fn:length(bean.total_code)-3)} , name:"${bean.name}",checkId:"${bean.id}",checked:isTrue(${bean.total_code})}
     		    </c:if>
     		   <c:if test="${fn:length(bean.total_code) == 3}">
     			 
     		   	 {id:${bean.total_code}, pId:0, name:"${bean.name}",checkId:"${bean.id}" ,checked:isTrue(${bean.total_code})}
     		    </c:if>
     		   <c:if test="${status.last==false}">, </c:if>
     		</c:forEach>			
	     ];
	
	$(document).ready(function(){
		var t = $("#treeDemo");
		t = $.fn.zTree.init(t, setting, zNodes);	
	});
	function isTrue(total_code){
		var istrue = false;
		for(var i =0;i<codeArray.length;i++){
			if(codeArray[i] == total_code){
				istrue = true;
			}
		}
		return istrue;
	}
	function returnValueName(){
		var submitObjectArray = new Array(0);
		var t = $.fn.zTree.getZTreeObj("treeDemo");
		nodes=t.getCheckedNodes(true);
	    if(nodes.length>0){
                for(var nlen=0;nlen<nodes.length;nlen++){
               	var tempObj = new Object();
    				tempObj["childName"] = nodes[nlen].name;
    				tempObj["returnValue"] = nodes[nlen].id;
    				submitObjectArray[submitObjectArray.length] = tempObj
                 }
		    }
	    return submitObjectArray;
	}
</script>
</body>
</html>